package com.oet.persistence.entity;

// Generated Feb 6, 2010 3:22:38 PM by Hibernate Tools 3.2.4.GA

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Transient;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * YdkAccount generated by hbm2java
 */
@Entity
@Table(name = "mngr_account", catalog = "oet")
public class MngrAccount implements java.io.Serializable {

	private Long id;
	private int role;
	private String name;
	private String password;
	private String email;
	private Boolean isActived;
	private Date lastAccessed;
	private Date accessTime;

	public MngrAccount() {
	}

	public MngrAccount(int role, String name, String email) {
		this.role = role;
		this.name = name;
		this.email = email;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

//	@ManyToOne(fetch = FetchType.LAZY)
	@Column(name = "role")
	public int getRole() {
		return this.role;
	}

	public void setRole(int role) {
		this.role = role;
	}
	@Transient
	public void addRole(int role) {
		this.role = this.role | role;
	}
	@Transient
	public void removeRole(int role) {
		this.role = this.role & (~role);
	}

	@Column(name = "name", nullable = false, length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	

	/**
	 * @return the password
	 */
	@Column(name = "password", length = 50)
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	

	@Column(name = "email", nullable = false, length = 80)
	public String getEmail() {
		return this.email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	
	@Column(name = "is_actived")
	public Boolean getIsActived() {
		return this.isActived;
	}
	public void setIsActived(Boolean isActived) {
		this.isActived = isActived;
	}

	/**
	 * @return the lastAccessed
	 */
	@Column(name = "lastAccessed")
	public Date getLastAccessed() {
		return lastAccessed;
	}
	public void setLastAccessed(Date lastAccessed) {
		this.lastAccessed = lastAccessed;
	}

	/**
	 * @return the accessTime
	 */
	@Column(name = "accessTime")
	public Date getAccessTime() {
		return accessTime;
	}
	public void setAccessTime(Date accessTime) {
		this.accessTime = accessTime;
	}
	
	
	
	
	
	

}
